<!-- polls/templates/polls/base.html -->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}在线投票系统{% endblock %}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css">
    <style>
        :root {
            --primary-color: #4e73df;
            --secondary-color: #1cc88a;
        }
        body {
            background-color: #f8f9fc;
        }
        .navbar-brand {
            font-weight: 700;
            color: var(--primary-color) !important;
        }
        .card {
            border: none;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            transition: all 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }
        .card-header {
            border-radius: 15px 15px 0 0 !important;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        }
        .vote-btn {
            transition: all 0.3s;
        }
        .vote-btn:hover {
            transform: scale(1.05);
        }
        .chart-container {
            position: relative;
            height: 300px;
        }
        .countdown-badge {
            font-size: 0.8rem;
            padding: 5px 10px;
            border-radius: 50px;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm mb-4">
        <div class="container">
            <a class="navbar-brand" href="{% url 'polls:index' %}">
                <i class="bi bi-bar-chart-line me-2"></i>在线投票系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="{% url 'polls:index' %}">
                            <i class="bi bi-house-door me-1"></i>首页
                        </a>
                    </li>
                </ul>
                {% if user.is_authenticated %}
                <div class="d-flex align-items-center">
                    <span class="me-3 text-muted">
                        <i class="bi bi-person-circle me-1"></i>{{ user.username }}
                    </span>
                    <a href="{% url 'admin:logout' %}" class="btn btn-outline-danger">
                        <i class="bi bi-box-arrow-right"></i> 退出
                    </a>
                </div>
                {% else %}
                <a href="{% url 'admin:login' %}?next={{ request.path }}" class="btn btn-primary">
                    <i class="bi bi-lock"></i> 管理员登录
                </a>
                {% endif %}
            </div>
        </div>
    </nav>

    <main class="container mb-5">
        {% if messages %}
            {% for message in messages %}
            <div class="alert alert-{{ message.tags }} alert-dismissible fade show animate__animated animate__fadeIn" role="alert">
                <i class="bi bi-check-circle-fill me-2"></i>{{ message }}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
            {% endfor %}
        {% endif %}

        {% block content %}{% endblock %}
    </main>

    <footer class="py-4 bg-light mt-auto">
        <div class="container text-center">
            <p class="mb-0 text-muted">
                &copy; {% now "Y" %} 在线投票系统. 保留所有权利.
            </p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    {% block scripts %}{% endblock %}
</body>
</html>